var Counter = {
    template: `
        <div>
            <button @click="addOne">+1</button>
            <div>{{ count }}</div>
        </div>
    `,
    computed: {
        count () {
            return this.$store.state.count;
        }
    },
    methods: {
        addOne: function () {
            this.$store.commit('increment')
        }
    }
};

var store = new Vuex.Store({
    state: {
        count: 0
    },
    mutations: {
        increment (state) {
            state.count++;
        }
    }
})

var app = new Vue({
    el: '#app',
    store,
    components: {Counter}
});